package com.gdhz.xiaohengqin.web;

import com.gdhz.xiaohengqin.model.ErJingWanDto;
import com.gdhz.xiaohengqin.model.ErJingWanVo;
import com.gdhz.xiaohengqin.reservation.model.entity.ReservationRecord;
import com.gdhz.xiaohengqin.service.ErJingWanService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * 二井湾湿地公园闸机推送接口
 *
 * @author Swallows
 * @date 2025-08-06 15:52
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/erjingwan")
public class ErJingWanController {

    private final ErJingWanService erJingWanService;

    @PostMapping("/qrCode/push/notification")
    public Mono<ErJingWanVo<ReservationRecord>> push(@RequestBody ErJingWanDto erJingWanDto) {
        log.info("二井湾闸机推送过来的二维码地址: {}", erJingWanDto.getUrl());
        return erJingWanService.pushQrCodeNotification(erJingWanDto.getUrl());
    }
}
